var app = angular.module('myApp', []);
app.run(function($rootScope) { //$rootScope变量名不可更改
  var t = $rootScope;
  t.name = "Ari Lerner";
});

app.controller('firstController', function($scope) {
  $scope.person = {
    name: 'firstName'
  };

  var updateClock = function() {
    $scope.clock = new Date();
  };

  var timer = setInterval(function() {
    //updateClock.apply($scope);
    $scope.$apply(updateClock);
  }, 1000);

  updateClock();
});

//[]写法的意义？
app.controller('firstChildController', ['$scope', function($scope) {
  $scope.person.word = "Nothing";
  $scope.sayHello = function() {
    $scope.person.word = "Hello";
  }

  $scope.childName = "Ketty";

  $scope.big = true;

  $scope.setBig = function() {
    $scope.big = true;
  };

  $scope.setSmall = function() {
    $scope.big = false;
  };
}]);